<?php require_once('menu.php'); ?>
<script type="text/javascript">
$().ready(function() {
    $("#businessForm").validate({
        errorLabelContainer: $("#businessForm div.error")
    });
});
</script>

<table width="100%" class="menubar" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="menudottedline" width="40%">
        <?php
         if (isset($alert)) {
         ?>
            <div class="pathway">Alert:&nbsp;<?=$alert?></div>
        <?php
         }
         ?>
        </td>
        <td class="menudottedline" align="right">
            <table cellpadding="0" cellspacing="0" border="0" id="toolbar">
                <tr height="60" valign="middle" align="center">
                    <td>
                        <a class="toolbar" href="#">
                        <?php echo $html->image('admin/help_f2.png', array('align' => 'middle', 'border' => 0)); ?><br>Help
                        </a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br>
<br>
<div align="center" class="centermain">
    <div class="main">
        <table class="adminheading">
            <tr>
                <th class="info" rowspan="2" nowrap>Add Company</th>
            </tr>
        </table>

        <table class="adminform">
            <tr>
                <td width="60%" valign="top">
                    <form id="businessForm" name="businessForm" method="post" action="<?=$html->url('/admin/addcompany')?>" enctype="multipart/form-data">
                    <div class="error"></div>
                    <table class="adminlist" cellpadding=20>
                    	<tr>
                    		<th>Package Type</th>
                    	</tr>
                    	<tr>
                    		<td align="left"><?=$form->select('plan', $plans, null, array('id' => 'plan', 'style' => 'width: 300px', 'onchange' => 'javascript: this.form.submit();'))?></td>
                    	</tr>
                    </table>
                    <table class="adminlist" cellpadding=20>
                        <tr>
                            <th colspan=2>User Information</th>
                        </tr>
                        <tr>
                            <td align="left" width="20%"><font color="red"><b>*</b></font>&nbsp;Lastname</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[user][lastname]" id="lastname" style="width: 400px" title="Please enter your lastname<br/>" class="{required:true}">
                            </td>
						</tr>
                        <tr>
                            <td align="left" width="20%"><font color="red"><b>*</b></font>&nbsp;Firstname</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[user][firstname]" id="firstname" style="width: 400px" title="Please enter your firstname<br/>" class="{required:true}">
                            </td>
						</tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;Email</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[user][email]" id="email" style="width: 400px" title="Please enter your email address<br/>" class="{required:true,email:true}">
                            </td>
						</tr>
						<tr>
                            <td align="left" width="20%"><font color="red"><b>*</b></font>&nbsp;Password</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="password" name="data[user][password]" id="password" style="width: 400px">
                                Random Password:&nbsp;<input type="checkbox" name="data[user][random]">
                            </td>
						</tr>
					</table>
                    <table class="adminlist" cellpadding=20>
                        <tr>
                            <th colspan=2>Business Information</th>
                        </tr>
                        <tr>
                            <td align="left" width="20%"><font color="red"><b>*</b></font>&nbsp;Name</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][name]" id="businessname" style="width: 400px" title="Please enter your business name<br/>" class="{required:true}">
                            </td>
                        </tr>
                        <tr>
                            <td align="left">Keywords</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][keyword]" style="width: 400px">
                            </td>
                        </tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;Street</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][street]" id="street" style="width: 400px" title="Please enter your street<br/>" class="{required:true}">
                            </td>
                        </tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;City</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][city]" id="city" style="width: 400px" title="Please enter your city<br/>" class="{required:true}">
                            </td>
                        </tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;State</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <?php echo $form->select("state", $state, null, array("style" => "width: 210px;", 'title' => 'Please enter state where you live<br/>', 'class' => '{required:true}')) ?>
                            </td>
                        </tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;Zip Code</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][zip_code]" id="zipcode" style="width: 400px" title="Please enter your zip code<br/>" class="{required:true}">
                            </td>
                        </tr>
                        <tr>
                            <td align="left">Contact Person</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][contact_person]" style="width: 400px">
                            </td>
                        </tr>
                        <tr>
                            <td align="left"><font color="red"><b>*</b></font>&nbsp;Contact No.</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][contact_no]" id="contact_no" style="width: 400px" title="Please enter your contact number<br/>" class="{required:true}">
                                &nbsp;e.g.&nbsp;<i>(999) 999-9999</i>
                            </td>
                        </tr>
                        <tr bgcolor="#efefef">
                            <td colspan=2>&nbsp;</td>
                        </tr>
                        <?php
                         switch ($plan) {
                             case "Enhanced Listing":
                         ?>
                        <tr>
                            <td align="left" valign="top">Description</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <textarea name="data[business][description]" rows="10" cols="55"></textarea>
                            </td>
                        </tr>
                        <tr>
                            <td align="left">Website</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][website]" style="width: 400px">
                            </td>
                        </tr>
                        <tr bgcolor="#efefef">
                            <td colspan=2>&nbsp;</td>
                        </tr>
                        <?php
                             break;

                             case "Premium Listing":
                         ?>
                        <tr>
                            <td align="left" valign="top">Description</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <textarea name="data[business][description]" rows="10" cols="55"></textarea>
                            </td>
                        </tr>
                        <tr bgcolor="#efefef">
                            <td colspan=2>&nbsp;</td>
                        </tr>
                        <tr>
                            <td align="left">Website</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="text" name="data[business][website]" style="width: 400px">
                            </td>
                        </tr>
                        <tr>
                            <td align="left">Graphic to Upload</td>
                            <td align="left" style="border: 1px dotted #ccc; background-color: #efefef;">
                                <input type="file" name="data[register][Image]"><p>JPG, GIF or BMP only.<br/>File size must be no larger than 1MB</p>
                            </td>
                        </tr>
                        <tr bgcolor="#efefef">
                            <td colspan=2>&nbsp;</td>
                        </tr>
                        <?php
                             break;
                         }
                         ?>
                         <tr>
                            <td>&nbsp;</td>
                            <td align="left"><input type="submit" value="Save Account" style="width: 150px;" class="button"></td>
                         </tr>
                         <tr>
                            <td>&nbsp;</td>
                            <td align="left"><font color="red">Asterisk (*) denotes required fields</font></td>
                         </tr>
                    </table>
                    <input type="hidden" id="plan" name="plan" value="<?php echo $plan; ?>">
                    <input type="hidden" id="flag" name="flag">
                    </form>
                </td>
            </tr>
        </table>
    </div>
</div>